#include "stdafx.h"
#include "ClientPacketProducer.h"

#include <Game/Message.h>
#include <Network/TcpPacket.h>

ClientPacketProducer::ClientPacketProducer(TcpClient& client)
	: client_(client)
{
}


ClientPacketProducer::~ClientPacketProducer(void)
{
}

void ClientPacketProducer::SendPacket(MESSAGE_ID id, void* payload, size_t payloadSize)
{
	size_t packetSize;

	TcpOutgoinigPacketProcessor package;
	TcpPacket* p = package.Pack(id, payload, payloadSize, &packetSize);

	client_.GetConnection()->Send(p, packetSize);
}

void ClientPacketProducer::Login(uint64_t userId)
{
	msg_login_rq rq;
	rq.userId = userId;

	SendPacket(MSG_LOGIN, &rq, sizeof(rq));
}